<?php
namespace app\admin\model\myshuju\bind;
use app\admin\model\myshuju\myconfigs\MyConFig;
use think\facade\Db;

class MyLianDong extends MyConFig
{
    /**获取所有上级
     * @param int $id
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getPidAll($id=0){
        if($id==0){
            return $this->data;
        }
        $data = Db::name($this->table)
            ->where('id',$id)
            ->find();
        if($data['pid']!==0){
            $this->getPidAll($data['pid']);
        }
        $this->data[] = $data['id'];
        return $this->data;
    }
}